Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider the following C function.int fun (in... Start Learning for Free
Consider the following C function.
int fun (int n)
{
  int x=1, k;
  if (n==1) return x;
  for (k=1; k<n; ++k)
     x = x + fun(k) * fun(n – k);
  return x;
}
The return value of fun(5) is __________.
  • a)
    0
  • b)
    26
  • c)
    51
  • d)
    71
Correct answer is option 'C'. Can you explain this answer?
Most Upvoted Answer
Consider the following C function.int fun (int n){ int x=1, k; if (n==...
fun(5) = 1 + fun(1) * fun(4) + fun(2) * fun(3) + 
             fun(3) * fun(2) + fun(4) * fun(1)
       = 1 + 2*[fun(1)*fun(4) + fun(2)*fun(3)]
Substituting fun(1) = 1
       = 1 + 2*[fun(4) + fun(2)*fun(3)]
Calculating fun(2), fun(3) and fun(4)
fun(2) = 1 + fun(1)*fun(1) = 1 + 1*1 = 2
fun(3) = 1 + 2*fun(1)*fun(2) = 1 + 2*1*2 = 5
fun(4) = 1 + 2*fun(1)*fun(3) + fun(2)*fun(2)
       = 1 + 2*1*5 + 2*2 = 15
Substituting values of fun(2), fun(3) and fun(4)
fun(5) = 1 + 2*[15 + 2*5] = 51 
Free Test
Community Answer
Consider the following C function.int fun (int n){ int x=1, k; if (n==...
The function definition is incomplete and ends abruptly. Please provide the complete function definition for me to analyze and provide a response.
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Question Description
Consider the following C function.int fun (int n){ int x=1, k; if (n==1) return x; for (k=1; k<n; ++k) x = x + fun(k) * fun(n – k); return x;}The return value of fun(5) is __________.a)0b)26c)51d)71Correct answer is option 'C'. Can you explain this answer? for Computer Science Engineering (CSE) 2025 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Consider the following C function.int fun (int n){ int x=1, k; if (n==1) return x; for (k=1; k<n; ++k) x = x + fun(k) * fun(n – k); return x;}The return value of fun(5) is __________.a)0b)26c)51d)71Correct answer is option 'C'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider the following C function.int fun (int n){ int x=1, k; if (n==1) return x; for (k=1; k<n; ++k) x = x + fun(k) * fun(n – k); return x;}The return value of fun(5) is __________.a)0b)26c)51d)71Correct answer is option 'C'. Can you explain this answer?.
Solutions for Consider the following C function.int fun (int n){ int x=1, k; if (n==1) return x; for (k=1; k<n; ++k) x = x + fun(k) * fun(n – k); return x;}The return value of fun(5) is __________.a)0b)26c)51d)71Correct answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Consider the following C function.int fun (int n){ int x=1, k; if (n==1) return x; for (k=1; k<n; ++k) x = x + fun(k) * fun(n – k); return x;}The return value of fun(5) is __________.a)0b)26c)51d)71Correct answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider the following C function.int fun (int n){ int x=1, k; if (n==1) return x; for (k=1; k<n; ++k) x = x + fun(k) * fun(n – k); return x;}The return value of fun(5) is __________.a)0b)26c)51d)71Correct answer is option 'C'. Can you explain this answer?, a detailed solution for Consider the following C function.int fun (int n){ int x=1, k; if (n==1) return x; for (k=1; k<n; ++k) x = x + fun(k) * fun(n – k); return x;}The return value of fun(5) is __________.a)0b)26c)51d)71Correct answer is option 'C'. Can you explain this answer? has been provided alongside types of Consider the following C function.int fun (int n){ int x=1, k; if (n==1) return x; for (k=1; k<n; ++k) x = x + fun(k) * fun(n – k); return x;}The return value of fun(5) is __________.a)0b)26c)51d)71Correct answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider the following C function.int fun (int n){ int x=1, k; if (n==1) return x; for (k=1; k<n; ++k) x = x + fun(k) * fun(n – k); return x;}The return value of fun(5) is __________.a)0b)26c)51d)71Correct answer is option 'C'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam
Signup to solve all Doubts
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev